<!DOCTYPE html>
<html lang="en">
	<head>
	<meta charset="utf-8" />
	<title>UI</title>
	<script type="text/javascript" src="../../lufylegend-1.8.12.min.js"></script>
	<script type="text/javascript" src="../../lib/lufylegend.ui-0.8.0.min.js"></script>
	</head>
	<body style="margin:0;padding:0;">
			<div id="legend"></div>
<script>
init(50,"legend",800,450,main);
var layer,button;

function main(){
	LMouseEventContainer.set(LMouseEvent.MOUSE_DOWN,true);
	LMouseEventContainer.set(LMouseEvent.MOUSE_UP,true);
	LMouseEventContainer.set(LMouseEvent.MOUSE_MOVE,true);
	LGlobal.setDebug(true);
	var list = [
		{label:"File",list:[
			{label:"New",list:[
				{label:"File",click:function(){trace("File");}},
				{label:"Folder",click:function(){trace("Folder");}}
			]},
			{label:"New Open File",list:[
				{label:"File",click:function(){trace("File");}},
				{label:"Folder",click:function(){trace("Folder");}},
				{label:"Test",list:[
					{label:"File",click:function(){trace("File");}},
					{label:"Folder",click:function(){trace("Folder");}},
					{label:"Test",click:function(){trace("Test");}}
				]}
			]},
			{label:"Open File",click:function(){trace("Open File");}}
		]},
		{label:"Edit",list:[
			{label:"Test1",click:function(){trace("Test1");}},
			{label:"Test2",click:function(){trace("Test2");}}
		]},
		{label:"Project",list:[
			{label:"Test1",click:function(){trace("Test1");}},
			{label:"Test2",click:function(){trace("Test2");}}
		]},
		{label:"Window",list:[
			{label:"Test1",click:function(){trace("Test1");}},
			{label:"Test2",click:function(){trace("Test2");}}
		]},
		{label:"Help",list:[
			{label:"About",click:function(){trace("About");}},
			{label:"Test3",click:function(){trace("Test3");}}
		]}
	];
	
	layer = new LSprite();
	layer.y = 50;
	//layer.graphics.drawRect(1,"#ff0000",[0,0,LGlobal.width,LGlobal.height],true,"#999999");
	addChild(layer);
	addButton();
	addRadio();
	addCheckBox();
	addComboBox();
	addScrollbar();
	addRange();
	addWindow();
	
	var menu = new LMenubar(list,{textSize:20,textColor:"#FFFFFF",lineColor:"#000000",backgroundColor:"#333333"});
	addChild(menu);
}
function addButton(){
	var button01 = new LButtonSample1("测试按钮1");
	button01.x = 10;
	button01.y = 10;
	button01.buttonMode = false;
	layer.addChild(button01);
	/*
	button01.addEventListener(LMouseEvent.MOUSE_OVER,
		function(){trace("测试按钮1 MOUSE_OVER");}
	);
	button01.addEventListener(LMouseEvent.MOUSE_OUT,
		function(){trace("测试按钮1 MOUSE_OUT");}
	);*/
	
	var button02 = new LButtonSample1("测试按钮2",12);
	button02.backgroundColor = "#008800";
	button02.width = 250;
	button02.height = 50;
	button02.x = 150;
	button02.y = 10;
	layer.addChild(button02);
	button02.addEventListener(LMouseEvent.MOUSE_UP,function(){trace("测试按钮2 click");});
	
	var button03 = new LButtonSample2("测试按钮4");
	button03.backgroundColor = "blue";
	button03.x = 10;
	button03.y = 70;
	layer.addChild(button03);
	
	var button04 = new LButtonSample2("测试按钮5",20);
	button04.backgroundColor = "purple";
	button04.x = 150;
	button04.y = 70;
	layer.addChild(button04);
	
}
function addRange(){
	var r = new LRange(200);
	r.x = 10;
	r.y = 300;
	layer.addChild(r);
}
function addScrollbar(){
	var showObject = new LSprite();
	showObject.graphics.drawRect(2,"#ff0000",[0,0,500,500],true,"#ff0000");
	var t = new LTextField();
	//t.y = 300;
	t.color = "#000000";
	t.text = "あいう\nえおか\nきくけこさしすせそたちつてとあいうえおかきくけこさしすせそたちつてとあいうえおかきくけこさしすせそたちつてとあいうえおかきくけこさしすせそたちつてとあいうえおかきくけこさしすせそたちつてとあいうえおかきくけこさしすせそたちつてとあいうえおかきくけこさしすせそたちつてとあいうえおかきくけこさしすせそたちつてと";
	t.width = 300;
	t.stroke = true;
	t.size = 30;
	t.setWordWrap(true,35);
	showObject.addChild(t);
	var sc = new LScrollbar(showObject,200,200);
	sc.x = 450;
	sc.y = 20;
	layer.addChild(sc);
}
function addWindow(){
	var myWindow = new LWindow(350,250);
	myWindow.x = 200;
	myWindow.y = 100;
	layer.addChild(myWindow);
	
	var title = new LTextField();
	title.text = "窗口UI测试";
	title.size = 20;
	title.x = 100;
	title.y = 10;
	myWindow.layer.addChild(title);
	
	var nameLabel = new LTextField();
	nameLabel.text = "用户名：";
	nameLabel.x = 80;
	nameLabel.y = 70;
	myWindow.layer.addChild(nameLabel);
	var name = new LTextField();
	name.x = 150;name.setWordWrap(true);
	name.y = 70;
	name.setType(LTextFieldType.INPUT);
	myWindow.layer.addChild(name);
	var passLabel = new LTextField();
	passLabel.text = "密码：";
	passLabel.x = 80;
	passLabel.y = 110;
	myWindow.layer.addChild(passLabel);
	var pass = new LTextField();
	pass.x = 150;
	pass.y = 110;
	pass.displayAsPassword = true;
	pass.setType(LTextFieldType.INPUT);
	myWindow.layer.addChild(pass);

	var button01 = new LButtonSample1("登陆");
	button01.x = 100;
	button01.y = 150;
	myWindow.layer.addChild(button01);
	button01.addEventListener(LMouseEvent.MOUSE_UP,function(){
		LMessageBox.show({
			title:"message",
			message:"点击了登陆按钮"
		});
	});
	var button02 = new LButtonSample1("注册");
	button02.x = 200;
	button02.y = 150;
	myWindow.layer.addChild(button02);
}
function addComboBox(){
	var com = new LComboBox(20);
	com.x = 50;
	com.y= 210;
	com.setChild({label:"测试一",value:"aaa"});
	com.setChild({label:"测试二",value:"bbb"});
	com.setChild({label:"测试三",value:"ccc"});
	com.setChild({label:"测试四",value:"ddd"});
	layer.addChild(com);
}
function addCheckBox(){
	var check1 = new LCheckBox();
	check1.x = 50;
	check1.y= 160;
	layer.addChild(check1);
	var check2 = new LCheckBox();
	check2.x = 100;
	check2.y= 160;
	layer.addChild(check2);
}
function addRadio(){
	var radio = new LRadio();
	radio.x = 50;
	radio.y = 130;
	radio.setChildRadio(1,0,0);
	radio.setChildRadio(2,50,0);
	radio.setChildRadio(3,100,0);
	layer.addChild(radio);
}
</script>
	</body>
</html>
